package org.quipu.dto;

import java.util.Collection;
import java.util.LinkedList;
import java.util.List;

public class CategoryDto extends UniqueTitledDto {

    public enum Type {
        INCOME,
        OUTCOME
    }

    private Long bookId;
    private Long parentId;
    private Type type;
    private LinkedList<CategoryDto> childs = new LinkedList<CategoryDto>();
    private int depth = 0;

    public Long getBookId() {
        return bookId;
    }

    public void setBookId(Long bookId) {
        this.bookId = bookId;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public List<CategoryDto> getChilds() {
        return childs;
    }

    public void setChilds(Collection<CategoryDto> childs) {
        this.childs.clear();
        this.childs.addAll(childs);
    }

    public void addChild(CategoryDto child) {
        this.childs.add(child);
    }

    public void addChilds(Collection<CategoryDto> childs) {
        this.childs.addAll(childs);
    }

    public void clearChilds() {
        childs.clear();
    }

    public Type getType() {
        return type;
    }

    public void setType(Type type) {
        this.type = type;
    }

    public int getDepth() {
        return depth;
    }

    public void setDepth(int depth) {
        this.depth = depth;
    }
}
